1. Field of the Invention
The present invention relates to computer-based file systems. More particularly, the present invention relates to a technique for efficiently reading data ahead in a computer-based file system.
2. Description of the Related Art
Traditional UNIX-type systems implement a logical form of read ahead. When an application requests a block of data, the system reads n blocks ahead from the requested block of data within the data file based on the assumption that the application is likely to require the n blocks of data next. The exact distance to read ahead is determined based on a heuristic for detecting random versus sequential types of file access from an application. The decision to read ahead and how far is made at the file level. The read ahead may require multiple accesses to the media when all of the data that is to be read ahead is not sequential to the data that has been actually requested.
When a request to read specific blocks is received by an intelligent-type host-bus adapter (HBA) controller or even by an intelligent-type drive, then it is usual that a physical read ahead be performed. Hence, when specific sectors are requested from the disk by an operating system, these types of intelligent devices will read n additional sequential sectors from the media and store the read-ahead sectors in a local memory of the controller or drive.
While a logical read ahead at the filing system level and a physical read ahead at the device level improves performance, there are still a number of drawbacks. For example, one drawback is that heuristics are required at each level of a system that performs read ahead in order for determining how far each read ahead should be. At lower levels of the system, the heuristics do not have access to information on file layout that could benefit their optimization. Consequently, the heuristics at a lower level of the system may read ahead data that is totally unrelated to the file in question and, hence, delay subsequent read requests.
Another drawback is that each controller having memory must use heuristics to determine how to evict read-ahead data from the limited-sized memory buffers. Again, there is insufficient knowledge at lower levels of the system to make data eviction efficient. Additionally, the limited-sized buffers are small in comparison to main system memory. Yet another drawback is when data is read ahead into the buffer of a disk drive via a physical read ahead, there will be a delay from the time when the operating system requests the data to the time when the data can be transferred from the disk drive or the controller to the main system memory. Accordingly, the read requests may be delayed in a queue with other requests that have been previously received.
Still another drawback relates to the efficiency of issuing a small number of read requests for large blocks of data as opposed to issuing many requests for small blocks of data. When read requests going to controllers to obtain data they have read ahead physically can be reduced, the total number of commands/interrupts handled by the system can be accordingly reduced. Consequently, overall system efficiency would be improved a when physical read ahead is specified from the filing system as part of a normal read command, thereby avoiding later-received commands that would be required for the controller/disk to supply data that had already been physically read ahead.
Consequently, what is needed is a way to increase the effectiveness of read-ahead caching at the system level.